﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lapas.Common.Forms;
using Lapas.Common;
using WorkDAL.Voucher;

namespace VcHDBH
{
    public partial class HDBHListForm : VoucherListForm
    {
        public HDBHListForm()
        {
            InitializeComponent();
            UIFormat.FormatGrid(VcDetailHD_Grid, false, true, true, false);
            UIFormat.SetGridColumnFormat(ColAmount, FormatType.Number);
            UIFormat.SetGridColumnFormat(ColDiscount, FormatType.Number);
            UIFormat.SetGridColumnFormat(ColVolume, FormatType.Number);
            UIFormat.SetGridColumnFormat(ColPrice, FormatType.Number);

            this.VoucherType = "HD";
        }

        protected override void VcHeaderCellClick(Guid VoucherId)
        {
            try
            {
                //if (VoucherId != null)
                vcDetailBindingSource.DataSource = VoucherDetail_HdData.Instance().VcDetail_HD_GetList(VoucherId);
                VcDetailHD_Grid.DataSource = vcDetailBindingSource;
                BindData();
            }
            catch (Exception ex)
            {
                DisplayMessage.ShowError(ex.Message);
                return;
            }

        }

        private void HDBHListForm_Resize(object sender, EventArgs e)
        {
            VcDetailPanel.Width = this.Width;
            VcDetailPanel.Height = this.Height - VcDetailPanel.Top - 20;
        }
    }
}
